package com.hdb;

import javax.persistence.*;

/**
 * Created by aszer on 2016/11/12.
 */
@Entity
@Table(name = "order_good", schema = "testin", catalog = "")
@IdClass(TOrderGoodPK.class)
public class TOrderGood {
    private int count;
    private int orderId;
    private int goodId;

    @Basic
    @Column(name = "count", nullable = false)
    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Id
    @Column(name = "order_id", nullable = false)
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Id
    @Column(name = "good_id", nullable = false)
    public int getGoodId() {
        return goodId;
    }

    public void setGoodId(int goodId) {
        this.goodId = goodId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TOrderGood that = (TOrderGood) o;

        if (count != that.count) return false;
        if (orderId != that.orderId) return false;
        if (goodId != that.goodId) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = count;
        result = 31 * result + orderId;
        result = 31 * result + goodId;
        return result;
    }
}
